<extend name="Base/base" />
<block name='head'>
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/kaoqin.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/main.css"/>
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/diary.css"/>
    <link href="/Public/Admin/css/page.css" rel="stylesheet" />
    <style>
        ul.dynatree-container a.cur_user{color:#0066cc;font-weight:bolder;font-size:15px;}
    </style>
</block>
<block name="content" >
    <section class="layui-larry-box mian-page page-attendanceStatistics">
        <div class="layui-tab">
            <div class="layui-inline">
                <a class="layui-btn layui-btn-normal newsAdd_btn" href="{:U('Personal/diary')}" style="color:#fff">返回</a>
            </div>
        </div>
	<div class="larry-personal">
            <div class="layui-tab">
                <div class="layui-tab-content larry-personal-body clearfix mylog-info-box tabRedefine layui-tab-brief">
                    <div class="layui-tab-item layui-field-box layui-show">
                        <input type="hidden" id="is_view" value="{$is_view}">
                        <input type="hidden" id="ajaxurl" value="{:U('searchDiary')}" />
                        <table style="width:200px;display: inline;top:0px;left:0px;">
                            <tbody>
                                <tr>
                                    <td id="left">
                                        <div id="left_top" class="PageHeader diary_icon"></div>
                                            <table class="BlockTop">
                                                <tbody>
                                                    <tr>
                                                        <td class="left"></td>
                                                        <td class="center">
                                                           <a href="javascript:;" index="1" class="header header-active" target="user_diary">在职人员</a>
                                                        </td>
                                                        <td class="right"></td>
                                                     </tr>
                                                </tbody>
                                            </table>
                                            <div class="containers treeList" id="container_1">
                                                <div id="tree">
                                                    <ul class="dynatree-container dynatree-no-connector">
                                                        <li class="dynatree-lastsib">
                                                            <span class="dynatree-node dynatree-folder dynatree-expanded dynatree-has-children dynatree-lastsib dynatree-exp-el dynatree-ico-ef">
                                                                <img src="/Public/admin/images/root.png" alt="">
                                                                <a href="#" class="dynatree-title" title="江苏省城市轨道交通研究设计院股份有限公司">江苏省城市轨道交通研究设计院股份有限公司</a>
                                                            </span>
                                                            <ul style="">
                                                                <foreach name="department" item="dept">
                                                                    <li class="">
                                                                        <span class="deptName dynatree-node dynatree-folder dynatree-has-children dynatree-lazy dynatree-exp-cd dynatree-ico-cf">
                                                                            <span class="dynatree-expander">></span>
                                                                            <a href="#" class="dynatree-title" title="{$dept.dept_name}">{$dept.dept_name}</a>
                                                                        </span>
                                                                        <if condition='$is_view eq 2'>
                                                                            <ul style="display: block;">
                                                                                <foreach name="dept['dept_user']" item="user">
                                                                                    <li class="">
                                                                                        <span class="dynatree-node dynatree-exp-c dynatree-ico-c">
                                                                                            <span class="dynatree-connector"></span>
                                                                                            <a href="#" data-id="{$user.user_id}" class="dynatree-title user">{$user.user_name}</a>
                                                                                        </span>
                                                                                    </li>
                                                                                </foreach>
                                                                            </ul>
                                                                        <elseif condition='$is_view eq 1'/>
                                                                            <ul class="dept_user" style="display: none;">
                                                                                <foreach name="dept['dept_user']" item="user">
                                                                                    <li class="">
                                                                                        <span class="dynatree-node dynatree-exp-c dynatree-ico-c">
                                                                                            <span class="dynatree-connector"></span>
                                                                                            <a href="#" data-id="{$user.user_id}" data-user-name="{$user.user_name}" class="dynatree-title user">{$user.user_name}</a>
                                                                                        </span>
                                                                                    </li>
                                                                                 </foreach>
                                                                            </ul>
                                                                        </if>
                                                                    </li>
                                                                </foreach>
                                                            </ul>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div class="diaryContent" style="display: inline;position:absolute;left:200px;right:0px;height:100%;">
                            <div class="diary_top">
                                <font style="font-size:15px;font-weight:bolder;float:left;">{$infos[0].user_id|getChineseName} - 最新日志</font>
                                <span style="float:left;margin-left:20%;">共<font style="color:red;">{$infoCount}</font>条数据</span>
                            </div>
                            <div class="diary_content">
                                <foreach name="infos" item="info">
                                    <table class="TableTop" width="100%">
                                        <tbody>
                                            <tr><td class="left"></td>
                                                <td class="subject">
                                                    <a>{$info.subject}</a>
                                                </td>
                                                <td class="subject" align="right">
                                                    <div class="operate">
                                                    </div>
                                                </td>
                                                <td class="right"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <div class="one_diary">
                                        <div class="diary_type">工作日志 | 日志日期：{$info.date_date}</div>
                                        <div class="content" style="overflow-y:auto;overflow-x:auto;width=100%;height=100%">
                                            <p>{$info.content}</p>
                                        </div>
                                    </div>
                                </foreach>
                            </div>
                            <div class="page" style="text-align: right"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/Admin/js/personal.js"></script>
    <script type="text/javascript">
        $(initPersonal());
        //ajax分页
        function searchDiary(num,user_id,user_name,is_view) {
            var url = $('#ajaxurl').val();
            var data = {user_id:user_id,user_name:user_name,is_view:is_view,p:num};
            console.log(data);
            $.ajax({
                url: url,
                type: 'get',
                data:data,
                typeData: 'json',
                success: function (res) {
                    console.log(res);
                    if(res.status > 0){
                        var html_top = '<font style="font-size:15px;font-weight:bolder;float:left;">'+res.user_name+' - 最新日志</font>';
                        html_top += '<span style="float:left;margin-left:20%;">共<font style="color:red;">'+res.count+'</font>条数据</span>';
//                        html_top += '<span class="larry-table-page clearfix" style="float:right;margin-bottom:10px;"><input type="hidden" id="followUrl" value="searchDiary"><span id="page" class="page">';
//                        html_top += res.page;
                        $('.diary_top').html(html_top);
                        $('.page').html(res.page)
                        var html = '';
                        for(var i=0;i<res.data.length;i++){
                            //标题
                            html += '<table class="TableTop" width="100%"><tbody>';
                            html += '<tr><td class="left"></td><td class="subject">';
                            html += '<a href="#">' + res.data[i].subject + '</a>';
                            html += '</td><td class="subject" align="right"><div class="operate">&nbsp;&nbsp;';
                            html += '</div></td><td class="right"></td></tr></tbody></table>';

                            //内容
                            html += '<div class="one_diary">';
                            html += '<div class="diary_type">工作日志 | 日志日期：{$data.dia_date} 星期三 | 最后修改：{$data.last_edit_time}</div>';
                            html += '<div class="content" style="overflow-y:auto;overflow-x:auto;width=100%;height=100%">';
                            html += '<p>'+res.data[i].content+'</p>';
                            html += '</div><div class="content"></div><div class="content"></div></div>';


                        }
                        $('.diary_content').html(html);
                    }else{
                        $('.diary_top').html('');
                        $('.diary_content').html('该用户暂无日志');
                    }
                }
            })
        }

    </script>
</block>